corrcounts_merge <- readRDS("~/VersionControl/senescence_benchmarking/Data/corrcounts_merge.rds")
metadata_merge <- readRDS("~/VersionControl/senescence_benchmarking/Data/metadata_merge.rds")
SenescenceSignatures <- readRDS("~/VersionControl/senescence_benchmarking/CommonFiles/SenescenceSignatures_divided_newCellAge.RDS")
library(markeR)
library(ggplot2)
library(ggpubr)
library(edgeR)
?markeR
?CalculateScores
ℹ Rendering development documentation for "CalculateScores"
df_ssGSEA <- CalculateScores(data = corrcounts_merge, metadata = metadata_merge, method = "ssGSEA", gene_sets = SenescenceSignatures)
Considering unidirectional gene signature mode for signature [DOWN]_CellAge
Warning: useNames = NA is deprecated. Instead, specify either useNames = TRUE or useNames = FALSE.
No id variables; using all as measure variables
Considering unidirectional gene signature mode for signature [DOWN]_HernandezSegura
Warning: useNames = NA is deprecated. Instead, specify either useNames = TRUE or useNames = FALSE.
No id variables; using all as measure variables
Considering unidirectional gene signature mode for signature [DOWN]_SeneQuest
Warning: useNames = NA is deprecated. Instead, specify either useNames = TRUE or useNames = FALSE.
No id variables; using all as measure variables
Considering unidirectional gene signature mode for signature [UP]_CellAge
Warning: useNames = NA is deprecated. Instead, specify either useNames = TRUE or useNames = FALSE.
No id variables; using all as measure variables
Considering unidirectional gene signature mode for signature [UP]_HernandezSegura
Warning: useNames = NA is deprecated. Instead, specify either useNames = TRUE or useNames = FALSE.
No id variables; using all as measure variables
Considering unidirectional gene signature mode for signature [UP]_SeneQuest
Warning: useNames = NA is deprecated. Instead, specify either useNames = TRUE or useNames = FALSE.
No id variables; using all as measure variables
Considering unidirectional gene signature mode for signature CSgene
Warning: useNames = NA is deprecated. Instead, specify either useNames = TRUE or useNames = FALSE.
No id variables; using all as measure variables
Considering unidirectional gene signature mode for signature GOBP_CELLULAR_SENESCENCE
Warning: useNames = NA is deprecated. Instead, specify either useNames = TRUE or useNames = FALSE.
No id variables; using all as measure variables
Considering unidirectional gene signature mode for signature GOBP_NEGATIVE_REGULATION_OF_CELLULAR_SENESCENCE
Warning: useNames = NA is deprecated. Instead, specify either useNames = TRUE or useNames = FALSE.
No id variables; using all as measure variables
Considering unidirectional gene signature mode for signature GOBP_POSITIVE_REGULATION_OF_CELLULAR_SENESCENCE
Warning: useNames = NA is deprecated. Instead, specify either useNames = TRUE or useNames = FALSE.
No id variables; using all as measure variables
Considering unidirectional gene signature mode for signature REACTOME_CELLULAR_SENESCENCE
Warning: useNames = NA is deprecated. Instead, specify either useNames = TRUE or useNames = FALSE.
No id variables; using all as measure variables
Considering unidirectional gene signature mode for signature SAUL_SEN_MAYO
Warning: useNames = NA is deprecated. Instead, specify either useNames = TRUE or useNames = FALSE.
No id variables; using all as measure variables
senescence_triggers_colors <- c(
"none" = "#E57373", # Soft red
"Radiation" = "#BDBDBD", # Medium gray
"DNA damage" = "#64B5F6", # Brighter blue
"Telomere shortening" = "#4FC3F7", # Vivid sky blue
"DNA demethylation" = "#BA68C8", # Rich lavender
"Oxidative stress" = "#FDD835", # Strong yellow
"Conditioned Medium" = "#F2994A", # Warm orange
"Oncogene" = "#81C784", # Medium green
"Lipid Accumulation" = "#E57373", # Coral
"Calcium influx" = "#26A69A", # Deep teal
"Plasma membrane dysruption" = "#D32F2F", # Strong salmon
"OSKM factors" = "#FFB74D", # Bright peach
"YAP KO" = "#9575CD" # Deep pastel purple
)
cellTypes_colors <- c(
"Fibroblast" = "#FF6961", # Strong Pastel Red
"Keratinocyte" = "#FFB347", # Strong Pastel Orange
"Melanocyte" = "#FFD700", # Strong Pastel Yellow
"Endothelial" = "#77DD77", # Strong Pastel Green
"Neuronal" = "#779ECB", # Strong Pastel Blue
"Mesenchymal" = "#C27BA0" # Strong Pastel Purple
)
cond_cohend <- list(A=c("Senescent"), # if no variable is defined, will be the first that appears in the ggplot
B=c("Proliferative","Quiescent"))
PlotScores(ResultsList = df_ssGSEA, ColorVariable = "CellType", GroupingVariable="Condition", method ="ssGSEA", ColorValues = cellTypes_colors, ConnectGroups=TRUE, ncol = 6, nrow = 2, widthTitle=20, y_limits = NULL, legend_nrow = 2,cond_cohend=cond_cohend)
df_logmedian <- CalculateScores(data = corrcounts_merge, metadata = metadata_merge, method = "logmedian", gene_sets = SenescenceSignatures)
senescence_triggers_colors <- c(
"none" = "#E57373", # Soft red
"Radiation" = "#BDBDBD", # Medium gray
"DNA damage" = "#64B5F6", # Brighter blue
"Telomere shortening" = "#4FC3F7", # Vivid sky blue
"DNA demethylation" = "#BA68C8", # Rich lavender
"Oxidative stress" = "#FDD835", # Strong yellow
"Conditioned Medium" = "#F2994A", # Warm orange
"Oncogene" = "#81C784", # Medium green
"Lipid Accumulation" = "#E57373", # Coral
"Calcium influx" = "#26A69A", # Deep teal
"Plasma membrane dysruption" = "#D32F2F", # Strong salmon
"OSKM factors" = "#FFB74D", # Bright peach
"YAP KO" = "#9575CD" # Deep pastel purple
)
cellTypes_colors <- c(
"Fibroblast" = "#FF6961", # Strong Pastel Red
"Keratinocyte" = "#FFB347", # Strong Pastel Orange
"Melanocyte" = "#FFD700", # Strong Pastel Yellow
"Endothelial" = "#77DD77", # Strong Pastel Green
"Neuronal" = "#779ECB", # Strong Pastel Blue
"Mesenchymal" = "#C27BA0" # Strong Pastel Purple
)
cond_cohend <- list(A=c("Senescent"), # if no variable is defined, will be the first that appears in the ggplot
B=c("Proliferative","Quiescent"))
PlotScores(ResultsList = df_logmedian, ColorVariable = "CellType", GroupingVariable="Condition", method ="logmedian", ColorValues = cellTypes_colors, ConnectGroups=TRUE, ncol = 6, nrow = 2, widthTitle=20, y_limits = NULL, legend_nrow = 2,xlab=NULL, cond_cohend = cond_cohend)
df_ranking <- CalculateScores(data = corrcounts_merge, metadata = metadata_merge, method = "ranking", gene_sets = SenescenceSignatures)
Considering unidirectional gene signature mode for signature [DOWN]_CellAge
Considering unidirectional gene signature mode for signature [DOWN]_HernandezSegura
Considering unidirectional gene signature mode for signature [DOWN]_SeneQuest
Considering unidirectional gene signature mode for signature [UP]_CellAge
Considering unidirectional gene signature mode for signature [UP]_HernandezSegura
Considering unidirectional gene signature mode for signature [UP]_SeneQuest
Considering unidirectional gene signature mode for signature CSgene
Considering unidirectional gene signature mode for signature GOBP_CELLULAR_SENESCENCE
Considering unidirectional gene signature mode for signature GOBP_NEGATIVE_REGULATION_OF_CELLULAR_SENESCENCE
Considering unidirectional gene signature mode for signature GOBP_POSITIVE_REGULATION_OF_CELLULAR_SENESCENCE
Considering unidirectional gene signature mode for signature REACTOME_CELLULAR_SENESCENCE
Considering unidirectional gene signature mode for signature SAUL_SEN_MAYO
senescence_triggers_colors <- c(
"none" = "#E57373", # Soft red
"Radiation" = "#BDBDBD", # Medium gray
"DNA damage" = "#64B5F6", # Brighter blue
"Telomere shortening" = "#4FC3F7", # Vivid sky blue
"DNA demethylation" = "#BA68C8", # Rich lavender
"Oxidative stress" = "#FDD835", # Strong yellow
"Conditioned Medium" = "#F2994A", # Warm orange
"Oncogene" = "#81C784", # Medium green
"Lipid Accumulation" = "#E57373", # Coral
"Calcium influx" = "#26A69A", # Deep teal
"Plasma membrane dysruption" = "#D32F2F", # Strong salmon
"OSKM factors" = "#FFB74D", # Bright peach
"YAP KO" = "#9575CD" # Deep pastel purple
)
cellTypes_colors <- c(
"Fibroblast" = "#FF6961", # Strong Pastel Red
"Keratinocyte" = "#FFB347", # Strong Pastel Orange
"Melanocyte" = "#FFD700", # Strong Pastel Yellow
"Endothelial" = "#77DD77", # Strong Pastel Green
"Neuronal" = "#779ECB", # Strong Pastel Blue
"Mesenchymal" = "#C27BA0" # Strong Pastel Purple
)
cond_cohend <- list(A=c("Senescent"), # if no variable is defined, will be the first that appears in the ggplot
B=c("Proliferative","Quiescent"))
PlotScores(ResultsList = df_ranking, ColorVariable = "CellType", GroupingVariable="Condition", method ="ranking", ColorValues = cellTypes_colors, ConnectGroups=TRUE, ncol = 6, nrow = 2, widthTitle=20, y_limits = NULL, legend_nrow = 2,xlab=NULL, cond_cohend = cond_cohend)
plotlist <- list()
for (sig in names(df_ssGSEA)){
df_subset_ssGSEA <- df_ssGSEA[[sig]]
df_subset_logmedian <- df_logmedian[[sig]]
df_subset_merge <- merge(df_subset_ssGSEA,df_subset_logmedian,by="sample")
# Wrap the signature name using the helper function
wrapped_title <- wrap_title_aux(sig, width = 20)
plotlist[[sig]] <- ggplot2::ggplot(df_subset_merge, aes(x=score.x, y=score.y)) +
geom_point(size=4, alpha=0.8, fill="darkgrey", shape=21) +
theme_bw() +
xlab("ssGSEA Enrichment Score") +
ylab("Normalised Signature Score") +
ggtitle(wrapped_title) +
theme(plot.title = ggplot2::element_text(hjust = 0.5, size=10),
plot.subtitle = ggplot2::element_text(hjust = 0.5))
}
ggpubr::ggarrange(plotlist=plotlist, nrow=3, ncol=4, align = "h")
Try scores with bidirectional signatures
bidirectsigs <- readRDS("~/VersionControl/senescence_benchmarking/CommonFiles/SenescenceSignatures_complete_newCellAge.RDS")
for (sig in names(bidirectsigs)){
sigdf <- bidirectsigs[[sig]]
sigdf <- sigdf[,1:2] # remove the third column, if applicable
if(any(sigdf[,2]=="not_reported")){
sigdf <- sigdf[,1]
bidirectsigs[[sig]] <- sigdf
next
}
sigdf[,2] <- ifelse(sigdf[,2]=="enriched",1,-1)
bidirectsigs[[sig]] <- sigdf
}
bidirectsigs
$CellAge
$CSgene
[1] "TP53" "TERF2" "MAPK14" "CDKN2A" "CDKN1A" "CCNE1" "CCNA1" "MAPKAPK5" "CBX4" "TXN" "TBX2"
[12] "STAT3" "SRF" "BMI1" "MAP2K4" "MAP2K6" "MAP2K3" "MAPK8" "MAPK3" "MAPK1" "PRKCD" "PML"
[23] "OPA1" "ATM" "MDM2" "CXCL8" "IL6" "IGFBP7" "ID1" "HRAS" "H2AFX" "POT1" "SIRT1"
[34] "KDM6B" "PLA2R1" "EZH2" "E2F3" "E2F1" "CEBPB" "CDKN2D" "CDKN2B" "CDKN1B" "CDK6" "CDK4"
[45] "CDK2" "CDC42" "RBX1" "CDC27" "CDK1" "MAML1" "CD44" "MAD2L1BP" "MAP4K4" "AIM2" "RECQL4"
[56] "ARHGAP18" "KL" "MAPKAPK2" "AURKB" "SLC16A7" "CCNE2" "HIST1H2BJ" "HIST1H3F" "CCNA2" "MCM3AP" "CDC16"
[67] "TSC22D1" "CBS" "TNFSF13" "CTNNAL1" "EED" "PNPT1" "CDC23" "RNASET2" "TP63" "CAV1" "MKNK1"
[78] "TSLP" "HIST1H2BK" "PPM1D" "HAVCR2" "CBX2" "KDM2B" "DPY30" "C2orf40" "YPEL3" "HIST2H4A" "HIST1H4L"
[89] "HIST1H4E" "HIST1H4B" "HIST1H4H" "HIST1H4C" "HIST1H4J" "HIST1H4K" "HIST1H4F" "HIST1H4D" "HIST1H4A" "HIST1H3B" "HIST1H3H"
[100] "HIST1H3J" "HIST1H3G" "HIST1H3I" "HIST1H3E" "HIST1H3C" "HIST1H3D" "HIST1H3A" "HIST2H2BE" "HIST1H2BO" "HIST1H2BC" "HIST1H2BI"
[111] "HIST1H2BH" "HIST1H2BE" "HIST1H2BF" "HIST1H2BM" "HIST1H2BN" "HIST1H2BL" "HIST1H2BG" "HIST2H2AC" "HIST2H2AA3" "HIST1H2AB" "HIST1H2AC"
[122] "HIST1H2AJ" "HIST1H4I" "HIST3H3" "CALR" "HMGA2" "PHC3" "KAT6A" "EHMT1" "SMC6" "AIMP2" "CALCA"
[133] "DEK" "MAPKAPK3" "ZNF148" "YY1" "WRN" "WNT5A" "NR1H2" "UBE3A" "UBE2E1" "UBE2D1" "UBC"
[144] "UBB" "UBA52" "CDC26P1" "TYMS" "TWIST1" "HIRA" "RPS27AP11" "HIST2H2AA4" "TP73" "TOPÂ 1,00" "TNF"
[155] "TGFB2" "TGFB1" "TFDP1" "TERT" "TERF1" "BUB1B" "BUB1" "TCF3" "TBX3" "TAGLN" "STAT6"
[166] "STAT1" "BRAF" "SREBF1" "BRCA1" "SP1" "SOX5" "SOD2" "SNAI1" "SMARCB1" "SMARCA2" "HIST2H3D"
[177] "PHC1P1" "ACD" "SKIL" "LOC649620" "SLC13A3" "LOC647654" "SMURF2" "ANAPC1" "SHC1" "CPEB1" "H3F3AP6"
[188] "ZMAT3" "RBBP4P1" "SRSF3" "SRSF1" "SATB1" "S100A6" "RXRB" "RRM2" "RRM1" "RPS27A" "RPS6KA3"
[199] "RPS6KA2" "RPS6KA1" "RPL5" "RNF2" "RIT1" "RING1" "BCL2L1" "RELA" "BCL2" "CCND1" "RBP2"
[210] "RBL2" "RBL1" "RBBP7" "RBBP4" "NTN4" "RB1" "IL21" "RAN" "RAF1" "RAC1" "TNRC6C"
[221] "KIAA1524" "EP400" "CNOT6" "CBX8" "PTEN" "SEPN1" "BACH1" "PSMB5" "PROX1" "PRL" "MAP2K7"
[232] "MAP2K1" "MAPK10" "MAPK9" "MAPK11" "MAPK7" "PRKDC" "RNF114" "PRKCI" "ATF7IP" "MFN1" "PRKAA2"
[243] "CDKN2AIP" "RBM38" "PRG2" "HIST2H4B" "HJURP" "TMEM140" "PBRM1" "Mar-05" "PPARG" "PPARD" "POU2F1"
[254] "TERF2IP" "ERRFI1" "H2BFS" "PLK1" "PLAUR" "PIN1" "PIM1" "PIK3CA" "PHB" "PGR" "PGD"
[265] "PIAS4" "PDGFB" "SIRT6" "ANAPC11" "ANAPC7" "ANAPC5" "WNT16" "FZR1" "ZBTB7A" "ERGIC2" "PCNA"
[276] "FIS1" "PAX3" "NOX4" "MINK1" "PEBP1" "YBX1" "NINJ1" "NFKB1" "H2AFB1" "NDN" "NCAM1"
[287] "NBN" "MYC" "MYBL2" "MSN" "ASS1" "LOC441488" "MRE11A" "MOV10" "MMP7" "MIF" "MAP3K5"
[298] "MAP3K1" "MECP2" "MCL1" "MAGEA2" "SMAD9" "SMAD7" "SMAD6" "SMAD5" "SMAD4" "SMAD3" "SMAD2"
[309] "SMAD1" "MAD2L1" "MXD1" "MIR34A" "MIR30A" "MIR299" "MIR29A" "MIR22" "MIR217" "MIR21" "MIR205"
[320] "MIR203A" "MIR191" "MIR146A" "MIR141" "MIR10B" "ARNTL" "LMNB1" "LMNA" "LGALS9" "RHOA" "KRT5"
[331] "KRAS" "KIT" "KIR2DL4" "KCNJ12" "JUN" "JAK2" "ITGB4" "IRS1" "IRF7" "IRF5" "IRF3"
[342] "ING1" "IDO1" "ILF3" "IL15" "IL12B" "CXCR2" "IL4" "IGFBP5" "IGFBP3" "IGFBP1" "IGF1R"
[353] "IGF1" "H3F3AP5" "IFNG" "IFI16" "IDH1" "ID2" "HIST2H3A" "BIRC5" "HSPB1" "HSPA9" "HSPA5"
[364] "HSPA1A" "APEX1" "HNRNPA1" "FOXA3" "FOXA2" "FOXA1" "HMGA1" "HIF1A" "ANXA5" "HELLS" "HDAC1"
[375] "H3F3B" "H3F3A" "HIST1H2BB" "HIST1H2BD" "H2AFZ" "HIST1H2AD" "HIST1H2AE" "ANAPC4" "ANAPC2" "UBN1" "SENP1"
[386] "GUCY2C" "GSK3B" "UHRF1" "BRD7" "NSMCE2" "PTRF" "GPI" "GNAO1" "RPS6KA6" "TNRC6A" "AGO2"
[397] "B3GAT1" "DNAJC2" "GJA1" "AGO1" "EHF" "TINF2" "LDLRAP1" "ULK3" "GAPDH" "ABI3BP" "ASF1A"
[408] "HIST1H2BA" "G6PD" "ACKR1" "MTOR" "CDC26" "CNOT6L" "FOS" "CABIN1" "MORC3" "SUZ12" "NPTXR"
[419] "CBX6" "SIRT3" "CRTC1" "PPP1R13B" "SUN1" "SMC5" "TNRC6B" "FOXO1" "FOXM1" "TNIK" "SCMH1"
[430] "DKKÂ 1,00" "FGFR2" "FGF2" "HEPACAM" "FANCD2" "EWSR1" "ETS2" "ETS1" "ESR2" "ERF" "AKT1"
[441] "EREG" "ERBB2" "ENG" "ELN" "CRTC2" "EIF5A" "EGR1" "EGFR" "EEF1B2" "AGO4" "AGO3"
[452] "EEF1A1" "PHC2" "PHC1" "ABCA1" "E2F2" "DUSP6" "DUSP4" "HBEGF" "AGT" "DNMT3A" "AGER"
[463] "DKC1" "DAXX" "CYP3A4" "CTSZ" "CTSD" "CSNK2A1" "E2F7" "PARP1" "HIST3H2BB" "HIST2H3C" "JDP2"
[474] "HIST4H4" "CLU" "CKB" "RASSF1" "CHEK1" "TOPBP1" "UBE2C" "KIF2C" "BTG3" "EHMT2" "GADD45G"
[485] "NEK6" "ZMYND11" "SPINT2" "CENPA" "AGR2" "CEBPG" "HYOU1" "TADA3" "MCRS1" "NDRG1" "ANAPC10"
[496] "CDKN2C" "ZMPSTE24" "PSMD14" "NAMPT" "RAD50" "TRIM10" "DNM1L" "BCL2L11"
$GOBP_CELLULAR_SENESCENCE
[1] "AKT3" "MIR543" "CDK2" "CDK6" "CDKN1A" "ZMPSTE24" "CDKN1B" "CDKN2A" "CDKN2B" "CITED2" "KAT5" "PLK2" "NEK6"
[14] "ZNF277" "CGAS" "COMP" "MAPK14" "VASH1" "PLA2R1" "SMC5" "SIRT1" "MORC3" "NUP62" "ABL1" "ULK3" "RSL1D1"
[27] "FBXO5" "FBXO4" "MAGEA2B" "NSMCE2" "H2AX" "HLA-G" "HMGA1" "HRAS" "ID2" "IGF1R" "ING2" "KIR2DL4" "ARG2"
[40] "LMNA" "BMAL1" "MIR10A" "MIR146A" "MIR17" "MIR188" "MIR217" "MIR22" "MIR34A" "MAGEA2" "MAP3K3" "MAP3K5" "MIF"
[53] "MNT" "ATM" "NPM1" "YBX1" "OPA1" "PAWR" "ABI3" "FZR1" "WNT16" "SIRT6" "PML" "PRMT6" "PRELP"
[66] "PRKCD" "MAPK8" "MAPK11" "MAPK9" "MAPK10" "MAP2K1" "MAP2K3" "MAP2K6" "MAP2K7" "B2M" "ZMIZ1" "PTEN" "MIR20B"
[79] "RBL1" "BCL6" "MAP2K4" "BMPR1A" "SPI1" "SRF" "BRCA2" "NEK4" "TBX2" "TBX3" "MIR590" "TERC" "TERF2"
[92] "TERT" "TOP2B" "TP53" "TWIST1" "WNT1" "WRN" "SMC6" "KAT6A" "ZKSCAN3" "HMGA2" "CALR" "YPEL3" "ECRG4"
[105] "MAPKAPK5" "TP63" "PNPT1" "DNAJA3" "EEF1E1" "NUAK1"
$GOBP_NEGATIVE_REGULATION_OF_CELLULAR_SENESCENCE
$GOBP_POSITIVE_REGULATION_OF_CELLULAR_SENESCENCE
$HernandezSegura
$REACTOME_CELLULAR_SENESCENCE
[1] "CDC27" "E2F2" "SCMH1" "MRE11" "MAP2K3" "MAPK9" "ANAPC4" "MAP2K4" "MAP4K4" "RPS6KA2" "UBE2D1" "EED" "MAP2K7"
[14] "TNRC6C" "MAPKAPK5" "ANAPC5" "TNRC6A" "TINF2" "AGO1" "CDC23" "CABIN1" "MAPK1" "HIRA" "TNRC6B" "E2F1" "RBBP7"
[27] "MAPK3" "ACD" "NBN" "CCNE1" "FZR1" "ERF" "CDK6" "H2AZ2" "EZH2" "MAPK8" "UBE2S" "MAP2K6" "NFKB1"
[40] "MAPK10" "ANAPC15" "CDKN1B" "PHC1" "ASF1A" "MAPK14" "E2F3" "LMNB1" "RAD50" "TFDP2" "MAPKAPK3" "IL1A" "RPS6KA1"
[53] "UBN1" "RNF2" "CDKN2C" "CDK2" "H1-3" "H1-1" "H2BC11" "CDKN1A" "ID1" "AGO3" "POT1" "CDKN2D" "CDC16"
[66] "H3-3B" "KDM6B" "TERF2" "CCNA1" "PHC2" "AGO4" "ETS1" "CDK4" "MDM2" "IL6" "TXN" "HMGA1" "RB1"
[79] "MINK1" "TP53" "ANAPC11" "CBX8" "CBX4" "RPS27A" "CCNA2" "H2BC1" "TERF1" "CDKN2B" "CDKN2A" "ATM" "HMGA2"
[92] "UBC" "VENTX" "ANAPC1" "TNIK" "MOV10" "ETS2" "H2BC5" "H4C8" "RBBP4" "MAPKAPK2" "H3-3A" "IGFBP7" "ANAPC10"
[105] "ANAPC16" "MAPK7" "TERF2IP" "H3-4" "BMI1" "H1-4" "STAT3" "CXCL8" "UBE2E1" "UBB" "FOS" "IFNB1" "CEBPB"
[118] "KAT5" "RELA" "PHC3" "CBX2" "UBE2C" "CCNE2" "ANAPC2" "CDC26" "RPS6KA3" "JUN" "SUZ12" "H2AC6" "H2BC4"
[131] "EHMT1" "EP400" "H3C13" "CBX6" "H2AC20" "H1-5" "H2BC21" "H2BC13" "MAPK11" "SP1" "H1-2" "H2AX" "H1-0"
[144] "ANAPC7" "H2AC7" "H2BC26" "H4C3" "H3C12" "H4C11" "H3C4" "MAP3K5" "H4C16" "H2BC12" "TFDP1" "MDM4" "H3C14"
[157] "H3C15" "RING1" "EHMT2" "UBA52" "H2AJ" "H4C15" "H4C14" "H4C12" "H2BC14" "H2BC8" "H3C8" "H2AB1" "H2BC6"
[170] "H4C6" "H2BC17" "H3C6" "H4C13" "H3C11" "H2BC9" "H3C1" "H4C9" "H2AC14" "H2BC3" "H4C5" "H2AC8" "H4C4"
[183] "H2BC7" "H3C7" "H2AC4" "H2BC10" "H4C1" "H4C2" "H3C10" "MIR24-2" "MIR24-1" "H3C2" "H3C3" "H2AC18" "H2AC19"
$SAUL_SEN_MAYO
$SeneQuest
NA
df_logmedian <- CalculateScores(data = corrcounts_merge, metadata = metadata_merge, method = "logmedian", gene_sets = bidirectsigs)
Considering bidirectional gene signature mode for signature CellAge
Considering unidirectional gene signature mode for signature CSgene
Considering unidirectional gene signature mode for signature GOBP_CELLULAR_SENESCENCE
Considering unidirectional gene signature mode for signature GOBP_NEGATIVE_REGULATION_OF_CELLULAR_SENESCENCE
Considering unidirectional gene signature mode for signature GOBP_POSITIVE_REGULATION_OF_CELLULAR_SENESCENCE
Considering bidirectional gene signature mode for signature HernandezSegura
Considering unidirectional gene signature mode for signature REACTOME_CELLULAR_SENESCENCE
Considering unidirectional gene signature mode for signature SAUL_SEN_MAYO
Considering bidirectional gene signature mode for signature SeneQuest
senescence_triggers_colors <- c(
"none" = "#E57373", # Soft red
"Radiation" = "#BDBDBD", # Medium gray
"DNA damage" = "#64B5F6", # Brighter blue
"Telomere shortening" = "#4FC3F7", # Vivid sky blue
"DNA demethylation" = "#BA68C8", # Rich lavender
"Oxidative stress" = "#FDD835", # Strong yellow
"Conditioned Medium" = "#F2994A", # Warm orange
"Oncogene" = "#81C784", # Medium green
"Lipid Accumulation" = "#E57373", # Coral
"Calcium influx" = "#26A69A", # Deep teal
"Plasma membrane dysruption" = "#D32F2F", # Strong salmon
"OSKM factors" = "#FFB74D", # Bright peach
"YAP KO" = "#9575CD" # Deep pastel purple
)
cellTypes_colors <- c(
"Fibroblast" = "#FF6961", # Strong Pastel Red
"Keratinocyte" = "#FFB347", # Strong Pastel Orange
"Melanocyte" = "#FFD700", # Strong Pastel Yellow
"Endothelial" = "#77DD77", # Strong Pastel Green
"Neuronal" = "#779ECB", # Strong Pastel Blue
"Mesenchymal" = "#C27BA0" # Strong Pastel Purple
)
cond_cohend <- list(A=c("Senescent"), # if no variable is defined, will be the first that appears in the ggplot
B=c("Proliferative","Quiescent"))
PlotScores(ResultsList = df_logmedian, ColorVariable = "CellType", GroupingVariable="Condition", method ="logmedian", ColorValues = cellTypes_colors, ConnectGroups=TRUE, ncol = 3, nrow = 3, widthTitle=20, y_limits = NULL, legend_nrow = 2,xlab=NULL, cond_cohend = cond_cohend)
df_ssgsea <- CalculateScores(data = corrcounts_merge, metadata = metadata_merge, method = "ssGSEA", gene_sets = bidirectsigs)
Considering bidirectional gene signature mode for signature CellAge
Warning: useNames = NA is deprecated. Instead, specify either useNames = TRUE or useNames = FALSE.
No id variables; using all as measure variables
Warning: useNames = NA is deprecated. Instead, specify either useNames = TRUE or useNames = FALSE.
No id variables; using all as measure variables
Considering unidirectional gene signature mode for signature CSgene
Warning: useNames = NA is deprecated. Instead, specify either useNames = TRUE or useNames = FALSE.
No id variables; using all as measure variables
Considering unidirectional gene signature mode for signature GOBP_CELLULAR_SENESCENCE
Warning: useNames = NA is deprecated. Instead, specify either useNames = TRUE or useNames = FALSE.
No id variables; using all as measure variables
Considering unidirectional gene signature mode for signature GOBP_NEGATIVE_REGULATION_OF_CELLULAR_SENESCENCE
Warning: useNames = NA is deprecated. Instead, specify either useNames = TRUE or useNames = FALSE.
No id variables; using all as measure variables
Considering unidirectional gene signature mode for signature GOBP_POSITIVE_REGULATION_OF_CELLULAR_SENESCENCE
Warning: useNames = NA is deprecated. Instead, specify either useNames = TRUE or useNames = FALSE.
No id variables; using all as measure variables
Considering bidirectional gene signature mode for signature HernandezSegura
Warning: useNames = NA is deprecated. Instead, specify either useNames = TRUE or useNames = FALSE.
No id variables; using all as measure variables
Warning: useNames = NA is deprecated. Instead, specify either useNames = TRUE or useNames = FALSE.
No id variables; using all as measure variables
Considering unidirectional gene signature mode for signature REACTOME_CELLULAR_SENESCENCE
Warning: useNames = NA is deprecated. Instead, specify either useNames = TRUE or useNames = FALSE.
No id variables; using all as measure variables
Considering unidirectional gene signature mode for signature SAUL_SEN_MAYO
Warning: useNames = NA is deprecated. Instead, specify either useNames = TRUE or useNames = FALSE.
No id variables; using all as measure variables
Considering bidirectional gene signature mode for signature SeneQuest
Warning: useNames = NA is deprecated. Instead, specify either useNames = TRUE or useNames = FALSE.
No id variables; using all as measure variables
Warning: useNames = NA is deprecated. Instead, specify either useNames = TRUE or useNames = FALSE.
No id variables; using all as measure variables
senescence_triggers_colors <- c(
"none" = "#E57373", # Soft red
"Radiation" = "#BDBDBD", # Medium gray
"DNA damage" = "#64B5F6", # Brighter blue
"Telomere shortening" = "#4FC3F7", # Vivid sky blue
"DNA demethylation" = "#BA68C8", # Rich lavender
"Oxidative stress" = "#FDD835", # Strong yellow
"Conditioned Medium" = "#F2994A", # Warm orange
"Oncogene" = "#81C784", # Medium green
"Lipid Accumulation" = "#E57373", # Coral
"Calcium influx" = "#26A69A", # Deep teal
"Plasma membrane dysruption" = "#D32F2F", # Strong salmon
"OSKM factors" = "#FFB74D", # Bright peach
"YAP KO" = "#9575CD" # Deep pastel purple
)
cellTypes_colors <- c(
"Fibroblast" = "#FF6961", # Strong Pastel Red
"Keratinocyte" = "#FFB347", # Strong Pastel Orange
"Melanocyte" = "#FFD700", # Strong Pastel Yellow
"Endothelial" = "#77DD77", # Strong Pastel Green
"Neuronal" = "#779ECB", # Strong Pastel Blue
"Mesenchymal" = "#C27BA0" # Strong Pastel Purple
)
cond_cohend <- list(A=c("Senescent"), # if no variable is defined, will be the first that appears in the ggplot
B=c("Proliferative","Quiescent"))
PlotScores(ResultsList = df_ssgsea, ColorVariable = "CellType", GroupingVariable="Condition", method ="ssGSEA", ColorValues = cellTypes_colors, ConnectGroups=TRUE, ncol = 3, nrow = 3, widthTitle=20, y_limits = NULL, legend_nrow = 2,xlab=NULL, cond_cohend = cond_cohend)
df_ranking <- CalculateScores(data = corrcounts_merge, metadata = metadata_merge, method = "ranking", gene_sets = bidirectsigs)
Considering bidirectional gene signature mode for signature CellAge
Considering unidirectional gene signature mode for signature CSgene
Considering unidirectional gene signature mode for signature GOBP_CELLULAR_SENESCENCE
Considering unidirectional gene signature mode for signature GOBP_NEGATIVE_REGULATION_OF_CELLULAR_SENESCENCE
Considering unidirectional gene signature mode for signature GOBP_POSITIVE_REGULATION_OF_CELLULAR_SENESCENCE
Considering bidirectional gene signature mode for signature HernandezSegura
Considering unidirectional gene signature mode for signature REACTOME_CELLULAR_SENESCENCE
Considering unidirectional gene signature mode for signature SAUL_SEN_MAYO
Considering bidirectional gene signature mode for signature SeneQuest
senescence_triggers_colors <- c(
"none" = "#E57373", # Soft red
"Radiation" = "#BDBDBD", # Medium gray
"DNA damage" = "#64B5F6", # Brighter blue
"Telomere shortening" = "#4FC3F7", # Vivid sky blue
"DNA demethylation" = "#BA68C8", # Rich lavender
"Oxidative stress" = "#FDD835", # Strong yellow
"Conditioned Medium" = "#F2994A", # Warm orange
"Oncogene" = "#81C784", # Medium green
"Lipid Accumulation" = "#E57373", # Coral
"Calcium influx" = "#26A69A", # Deep teal
"Plasma membrane dysruption" = "#D32F2F", # Strong salmon
"OSKM factors" = "#FFB74D", # Bright peach
"YAP KO" = "#9575CD" # Deep pastel purple
)
cellTypes_colors <- c(
"Fibroblast" = "#FF6961", # Strong Pastel Red
"Keratinocyte" = "#FFB347", # Strong Pastel Orange
"Melanocyte" = "#FFD700", # Strong Pastel Yellow
"Endothelial" = "#77DD77", # Strong Pastel Green
"Neuronal" = "#779ECB", # Strong Pastel Blue
"Mesenchymal" = "#C27BA0" # Strong Pastel Purple
)
cond_cohend <- list(A=c("Senescent"), # if no variable is defined, will be the first that appears in the ggplot
B=c("Proliferative","Quiescent"))
PlotScores(ResultsList = df_ranking, ColorVariable = "CellType", GroupingVariable="Condition", method ="ranking", ColorValues = cellTypes_colors, ConnectGroups=TRUE, ncol = 3, nrow = 3, widthTitle=20, y_limits = NULL, legend_nrow = 2,xlab=NULL, cond_cohend = cond_cohend)
PlotScores(data = corrcounts_merge,
metadata = metadata_merge,
gene_sets=bidirectsigs,
GroupingVariable="Condition",
method ="all",
ncol = NULL,
nrow = NULL,
widthTitle=30,
limits = NULL,
title="Marthandan et al. 2016",
titlesize = 12,
ColorValues = NULL)
Considering bidirectional gene signature mode for signature CellAge
Warning: useNames = NA is deprecated. Instead, specify either useNames = TRUE or useNames = FALSE.
No id variables; using all as measure variables
Warning: useNames = NA is deprecated. Instead, specify either useNames = TRUE or useNames = FALSE.
No id variables; using all as measure variables
Considering unidirectional gene signature mode for signature CSgene
Warning: useNames = NA is deprecated. Instead, specify either useNames = TRUE or useNames = FALSE.
No id variables; using all as measure variables
Considering unidirectional gene signature mode for signature GOBP_CELLULAR_SENESCENCE
Warning: useNames = NA is deprecated. Instead, specify either useNames = TRUE or useNames = FALSE.
No id variables; using all as measure variables
Considering unidirectional gene signature mode for signature GOBP_NEGATIVE_REGULATION_OF_CELLULAR_SENESCENCE
Warning: useNames = NA is deprecated. Instead, specify either useNames = TRUE or useNames = FALSE.
No id variables; using all as measure variables
Considering unidirectional gene signature mode for signature GOBP_POSITIVE_REGULATION_OF_CELLULAR_SENESCENCE
Warning: useNames = NA is deprecated. Instead, specify either useNames = TRUE or useNames = FALSE.
No id variables; using all as measure variables
Considering bidirectional gene signature mode for signature HernandezSegura
Warning: useNames = NA is deprecated. Instead, specify either useNames = TRUE or useNames = FALSE.
No id variables; using all as measure variables
Warning: useNames = NA is deprecated. Instead, specify either useNames = TRUE or useNames = FALSE.
No id variables; using all as measure variables
Considering unidirectional gene signature mode for signature REACTOME_CELLULAR_SENESCENCE
Warning: useNames = NA is deprecated. Instead, specify either useNames = TRUE or useNames = FALSE.
No id variables; using all as measure variables
Considering unidirectional gene signature mode for signature SAUL_SEN_MAYO
Warning: useNames = NA is deprecated. Instead, specify either useNames = TRUE or useNames = FALSE.
No id variables; using all as measure variables
Considering bidirectional gene signature mode for signature SeneQuest
Warning: useNames = NA is deprecated. Instead, specify either useNames = TRUE or useNames = FALSE.
No id variables; using all as measure variables
Warning: useNames = NA is deprecated. Instead, specify either useNames = TRUE or useNames = FALSE.
No id variables; using all as measure variables
Considering bidirectional gene signature mode for signature CellAge
Considering unidirectional gene signature mode for signature CSgene
Considering unidirectional gene signature mode for signature GOBP_CELLULAR_SENESCENCE
Considering unidirectional gene signature mode for signature GOBP_NEGATIVE_REGULATION_OF_CELLULAR_SENESCENCE
Considering unidirectional gene signature mode for signature GOBP_POSITIVE_REGULATION_OF_CELLULAR_SENESCENCE
Considering bidirectional gene signature mode for signature HernandezSegura
Considering unidirectional gene signature mode for signature REACTOME_CELLULAR_SENESCENCE
Considering unidirectional gene signature mode for signature SAUL_SEN_MAYO
Considering bidirectional gene signature mode for signature SeneQuest
Considering bidirectional gene signature mode for signature CellAge
Considering unidirectional gene signature mode for signature CSgene
Considering unidirectional gene signature mode for signature GOBP_CELLULAR_SENESCENCE
Considering unidirectional gene signature mode for signature GOBP_NEGATIVE_REGULATION_OF_CELLULAR_SENESCENCE
Considering unidirectional gene signature mode for signature GOBP_POSITIVE_REGULATION_OF_CELLULAR_SENESCENCE
Considering bidirectional gene signature mode for signature HernandezSegura
Considering unidirectional gene signature mode for signature REACTOME_CELLULAR_SENESCENCE
Considering unidirectional gene signature mode for signature SAUL_SEN_MAYO
Considering bidirectional gene signature mode for signature SeneQuest
# missing:
# - combine legends
# - wrap title
# - tilt x labels to 60 degrees
# - change default colors
# wrap x labels with wrap_title
# grid with common legends https://support.bioconductor.org/p/87318/
IndividualGenes_Violins(data = corrcounts_merge, metadata = metadata_merge, genes = c("CDKN1A", "CDKN2A", "GLB1","TP53","CCL2"), GroupingVariable = "Condition", plot=T, ncol=NULL, nrow=2, divide="CellType", invert_divide=FALSE,ColorValues=senescence_triggers_colors, pointSize=2, ColorVariable="SenescentType", title="Senescence", widthTitle=16,y_limits = NULL,legend_nrow=4, xlab="Condition",colorlab="")
Using gene as id variables
CorrelationHeatmap(data=corrcounts_merge,
metadata = metadata_merge,
genes=c("CDKN1A", "CDKN2A", "GLB1","TP53","CCL2"),
separate.by = "Condition",
method = "pearson",
colorlist = list(low = "#3F4193", mid = "#F9F4AE", high = "#B44141"),
limits_colorscale = c(-1,0,1),
widthTitle = 16,
title = "test",
cluster_rows = TRUE,
cluster_columns = TRUE,
detailedresults = FALSE,
legend_position="right",
titlesize=20)
Warning: Heatmap/annotation names are duplicated: pearson's coefficient
Warning: Heatmap/annotation names are duplicated: pearson's coefficient, pearson's coefficient
Warning: `legend_height` you specified is too small, use the default minimal height.
Warning: `legend_height` you specified is too small, use the default minimal height.
Warning: `legend_height` you specified is too small, use the default minimal height.
degenes <- calculateDE(data=corrcounts_merge,
metadata=metadata_merge,
variables="Condition",
lmexpression = NULL,
modelmat = NULL,
contrasts = c("Senescent - Proliferative",
"Senescent - Quiescent",
"Proliferative - Quiescent"))
degenes
$`Senescent - Proliferative`
$`Senescent - Quiescent`
$`Proliferative - Quiescent`
NA
options(error=recover)
plotVolcano(DEResultsList=degenes, genes=bidirectsigs, N=NULL, x="logFC",y="-log10(adj.P.Val)", pointSize=2, color="pink", highlightcolor="darkblue", nointerestcolor="grey",threshold_y=NULL, threshold_x=NULL, xlab=NULL, ylab=NULL, ncol=NULL, nrow=NULL, title="test",labsize=10,widthlabs=25, invert=T)
#' Run Gene Set Enrichment Analysis (GSEA) using fgsea
#'
#' This function runs Gene Set Enrichment Analysis (GSEA) on a vector or list of gene-level statistics using the fgsea package.
#' Gene-level statistics are sorted in decreasing order, and each gene set is processed to extract gene names.
#'
#' @param geneStats A numeric vector of gene-level statistics with names corresponding to gene identifiers, or a list of such vectors.
#' @param gene_sets A named list of gene sets. Each element can be a vector of gene names (for unidirectional sets) or a data frame (for bidirectional sets)
#' where the first column contains gene names.
#' @param nperm Number of permutations to use in fgsea. Default is 1000.
#'
#' @return An fgsea results object if a single geneStats vector is provided, or a list of fgsea results if \code{geneStats} is a list.
#'
#' @details
#' Each gene set is processed by extracting gene names (using the first column if a data frame is provided). For each geneStats vector,
#' the values are sorted in decreasing order and passed to \code{fgsea::fgsea} along with the pathways.
#'
#' @examples
#' \dontrun{
#' # Suppose de_res is a numeric vector of gene-level stats, and gene_sets is a list of gene sets.
#' fgsea_result <- runFGSEA(de_res, gene_sets, nperm = 1000)
#'
#' # For multiple DE results provided as a list:
#' fgsea_results_list <- runFGSEA(list(result1 = de_res, result2 = de_res2), gene_sets)
#' }
#'
#' @importFrom fgsea fgsea
#' @export
runFGSEA <- function(geneStats, gene_sets, nperm = 1000) {
pathways <- lapply(gene_sets, function(gs) {
if (is.data.frame(gs)) {
return(as.character(gs[[1]]))
} else if (is.vector(gs)) {
return(as.character(gs))
} else {
stop("Each element in gene_sets must be either a data frame or a vector of gene names.")
}
})
if (is.null(names(pathways))) {
names(pathways) <- paste0("pathway", seq_along(pathways))
}
run_fgsea_single <- function(stats) {
stats <- sort(stats, decreasing = TRUE)
fgsea::fgsea(pathways = pathways, stats = stats, nperm = nperm)
}
if (is.list(geneStats)) {
res_list <- lapply(geneStats, run_fgsea_single)
return(res_list)
} else {
return(run_fgsea_single(geneStats))
}
}
calculateGSEA <- function(data, metadata, gene_sets, variables, lmexpression=NULL, contrasts=NULL, coefs=NULL){
# define linear model
# If bidirectional (t-statistic; difference between peaks)
# If unidirectional (t-statistic)
# if direction is not known (B statistic)
}
#allow the user to choose what representation he wants.
# DEG per contrast for each signature with highlighted signature genes: grid of plots, columns are signatures, rows are contrasts
# volcano-like plot for NES vs padj
# Iceberg plot for each contrast for each signature: grid of plots, columns are signatures, rows are contrasts
plotGSEA <- function(data, metadata, gene_sets, variables, lmexpression=NULL, contrasts=NULL, coefs=NULL){
}